<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>layui</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="../../css/layui.css" media="all">
		 <link href="../../bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet">
		<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
		<script type="text/javascript" src="../../js/jquery.min.js"></script>
		<link rel="stylesheet" href="../../css/layui.css" media="all">
		<script type="text/javascript" src="../../js/vue.min.js"></script>
	</head>

	<body>

		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;width:97%;">
			<legend>添加课程</legend>
		</fieldset>

		<div class="layui-tab">
			<form id="form" method="post" enctype="multipart/form-data">
				<div id="set1">
					<!--<div class="layui-tab-item layui-show">
						1. 高度默认自适应，也可以随意固宽。
						<br>2. Tab进行了响应式处理，所以无需担心数量多少。
					</div>-->
					<div class="alert alert-warning alert-dismissible" role="alert" style="width:600px;">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<strong>警告!</strong> 课程一旦添加成功，只可以进行编辑，请仔细核查课程信息
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label" style="width:100px;">课程名</label>
							<div class="layui-input-inline">
								<input type="text" id="couName" name="couName" class="layui-input">
							</div>
						</div>
					</div>
					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label" style="width:100px;">课程描述</label>
						
						<div class="layui-input-block">
							<textarea placeholder="请输入内容" class="layui-textarea" id="couDes" name="couDes" style="width:600px;"></textarea>
						</div>
					</div>
					<!--<div class="layui-input-block">
						<button class="layui-btn" lay-submit="" lay-filter="demo1" @click="add()">立即提交</button>

					</div>-->

				</div>

			</form>
		</div>

        <script src="../../bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
		<script src="../../layui.js" charset="utf-8"></script>
		<script src="../../js/jquery.cookie.js"></script>
		<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
		<script>
			$.ajax({
				type: "get",
				url: "http://localhost:8080/teacher/experiment/nothing.do",
				async: false,
				dataType: "json",
				data:{
                    uid:$.cookie("uid") 
				},
				success: function(data) {
					//alert(data.info);
					if(data.info == '404') {
						window.location.href = "../login/teacherlogin.html";
					}
				}
			});
			function mySubmit() {
				add();

			}

			function add() {
				var couName = $("#couName").val();
				var couDes = $("#couDes").val();
				//alert(couName+couDes);
				$.ajax({
					url: 'http://localhost:8080/teacher/course/add.do',
					type: 'get',
					data: {
						couName: couName,
						couDes: couDes,
						uid:$.cookie("uid") 
					},
					dataType: 'json',
					/*contentType: 'application/json',*/
					success: function(result) {

					},
					error: function(result) {

					}
				});
			}
			
			
		</script>

	</body>

</html>